﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using Com.Framework;
using Com.Framework.File;
namespace Com.Web.coffinegurunaru.manager.file
{
	public partial class fileuploader : System.Web.UI.Page
	{
		protected void Page_Load(object sender, EventArgs e)
		{
			Server.ScriptTimeout = 60 * 5;
			if (this.IsPostBack)
			{
				if (Request.Files.Count > 0)
				{
					FileType FileType = Request.QueryString["FileType"].Parse(FileType.Upload);
					string Callback = Request.QueryString["Callback"].Parse(string.Empty);
					string FileURL = string.Empty;
					FileURL = FileManager.UploadFor(Request.Files[0], FileType);
					ClientScript.RegisterClientScriptBlock(this.GetType(), "callback",@"
<script language='javascript'>
$(function() {
opener." + Callback + @"('" + FileURL + @"');
self.close();
});
</script>
");
				}
			}
		}
	}
}
